package com.qike.duola.enums;

import com.qike.duola.vo.EnumList;

import java.util.ArrayList;
import java.util.List;

/**
 * 培训得分枚举
 * 得分 1 优秀 2良好 3合格 4不合格
 */
public enum TrainScoreEnums {
    NICE                 (1,"优秀"),
    GOOD                      (2,"良好"),
    STANDARD                      (3,"合格"),
    NOT_STANDARD                      (4,"不合格"),
    ;
    private Integer ecode;

    private String emsg;

    TrainScoreEnums(Integer ecode, String emsg) {
        this.ecode = ecode;
        this.emsg = emsg;
    }

    public Integer getEcode() {
        return ecode;
    }

    public String getEmsg() {
        return emsg;
    }

    public static TrainScoreEnums statOf(Integer ecode) {
        for (TrainScoreEnums state : values())
            if (state.getEcode().equals(ecode))
                return state;
        return null;
    }

    public List<EnumList> getEnumList(){
        List<EnumList> lists = new ArrayList<>();
        for (TrainScoreEnums state : values()){
            EnumList enumList = new EnumList();
            enumList.setKey(state.getEcode());
            enumList.setValue(state.getEmsg());
            lists.add(enumList);
        }
        return lists;
    }
}
